<?php
/**
 *	[TWCMS] (C)2012 TongWang Inc.
 *	$Id: content_html.php 2 2013-04-27 07:14:17Z nanown@qq.com $
 */
class content_html extends admin{
	function __construct() {
		parent::__construct();
		$this->main();
	}

	function main() {
		if(isset($_GET['ajax'])) {
			require base::load_sys_file('front', 'func');
			require base::load_sys_file('tpl');
			require base::load_sys_file('html');
			$this->html = new html($this);
			if(in_array($_GET['ajax'], array('index', 'cate', 'show'))) {
				$func = 'ajax_'.$_GET['ajax'];
				$this->$func();
				exit();
			}
		}else{
			include load_tpl(__CLASS__);
		}
	}

	#生成首页
	function ajax_index() {
		$this->html->write_index();
		echo '生成首页完成！';
	}

	#生成分类页
	function ajax_cate() {
		$this->html->write_cate('SELECT cid FROM `'.TW_DBPRE.'category` WHERE mid>1');
		echo '生成分类完成！';
	}

	#生成内容页
	function ajax_show() {
		$this->html->write_show('SELECT id FROM `'.TW_DBPRE.'article`');
		echo '生成内容完成！';
	}
}